<template>
  <div>
    <!-- <div>首页</div> -->
    <div class="main">
      <div
        class="report-card"
        v-for="report in reportList"
        :key="report.name"
        @click="openDetail(report)"
      >
        <div>
          <div class="title">{{ report.title }}</div>
          <div class="link">{{ report.link }}</div>
        </div>
        <div class="report-card__pic">
          <img
            class="report-card__pic__img"
            :src="require('@/assets/report.svg')"
            alt=""
          />
        </div>
      </div>
    </div>

    <CommonFloatMenu :columns="menuColumns"></CommonFloatMenu>

    <!-- <div v-if="loginShow" class="to-login" @click="toLogin">登录</div> -->
  </div>
</template>
  
  
  <script>
import { getQueryString, prexUrl } from "util/index.js";
import CommonFloatMenu from "@/components/common-float-menu/index.vue";

export default {
  name: "rpt-ls",
  components: { CommonFloatMenu },
  data() {
    return {
      menuConfig: {},
      menuColumns: [
        {
          title: "返回",
          colProps: {
            background: " #2751a6",
          },
          onClick: () => {
            this.$router.back();
          },
        },
      ],
      loginShow: process.env.NODE_ENV === "dev",
      reportList: [
        {
          id: 19,
          title: "EPC发运计划报表",
          link: "rpt-dt/epcProjectReport",
        },
        {
          id: 1,
          title: "需求台账报表",
          link: "rpt-dt/demandReport",
        },
        {
          id: 2,
          title: "采购合同台账报表",
          link: "rpt-dt/purchaseReport",
        },
        {
          id: 3,
          title: "发票一览表",
          link: "rpt-dt/invoiceReport",
        },
        {
          id: 4,
          title: "采购合同付款台账报表",
          link: "rpt-dt/paymentReport",
        },
        {
          id: 5,
          title: "产品信息一览表",
          link: "rpt-dt/productInfoReport",
        },
        {
          id: 6,
          title: "催交台账表",
          link: "rpt-dt/expedReport",
        },
        {
          id: 7,
          title: "监造台账报表",
          link: "rpt-dt/supervisionReport",
        },
        {
          id: 8,
          title: "国内检验台账报表",
          link: "rpt-dt/domesticInspectionReport",
        },
        {
          id: 9,
          title: "追溯号和报关料号对照表",
          link: "rpt-dt/traceCustomsReport",
        },
        {
          id: 10,
          title: "预估一级箱单汇总表",
          link: "rpt-dt/packingListReport",
        },
        {
          id: 11,
          title: "物流月度计划台账报表",
          link: "rpt-dt/logisticsMonthlyPlanLedgerReport",
        },
        {
          id: 12,
          title: "船期报表",
          link: "rpt-dt/scheduleReport",
        },
        {
          id: 13,
          title: "船次费用报表",
          link: "rpt-dt/shipCostManagementReport",
        },
        {
          id: 14,
          title: "供应商物资送港预报表",
          link: "rpt-dt/supplierMaterialsDeliveredReport",
        },
        {
          id: 15,
          title: "在港物资一览表",
          link: "rpt-dt/goodsInPortReport",
        },
        {
          id: 16,
          title: "国内检验追溯报表",
          link: "rpt-dt/domesticTrackReport",
        },
        {
          id: 17,
          title: "项目合同进度追踪报表",
          link: "rpt-dt/projectScheduleReport",
        },
        {
          id: 18,
          title: "时效报表",
          link: "rpt-dt/ageingReport",
        },
      ],
    };
  },
  methods: {
    openDetail(report) {
      let token = this.$route.query.token;
      if (!token) {
        window.location.href = prexUrl() + "/longnows#/login";
      } else {
        window.location.href =
          prexUrl() + "/" + report.link + "?token=" + token;
      }
    },
  },
  mounted() {
    console.log(this.$route.name);
  },
  beforeRouteLeave(to, from, next) {
    if (to.path == "/about") {
      this.$store.commit("SetKeep", this.$route.name);
    } else if (to.path == "/login") {
      this.$store.commit("RemoveKeep", this.$route.name);
    }
    next();
    // console.log(to, from, next);
  },
  // beforeRouteEnter(to, from, next){
  //   console.log(to, from, next)
  //   next()
  // }
};
</script>
  
  <style scoped lang="less">
.main {
  padding: 10px 0px;
}
.report-card {
  margin: 0 10px;
  margin-bottom: 15px;
  padding: 15px;
  background-color: #fff;
  border-radius: 15px;
  box-shadow: 0 8px 12px #ebedf0;
  overflow: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.link {
  font-size: 15px;
  color: #266fe8;
}

.report-card__pic {
  text-align: right;
}
.report-card__pic__img {
  width: 35px;
}
</style>